//package com.duqc.controller;
//
//import lombok.RequiredArgsConstructor;
//import lombok.extern.slf4j.Slf4j;
//import org.apache.rocketmq.client.exception.MQBrokerException;
//import org.apache.rocketmq.client.exception.MQClientException;
//import org.apache.rocketmq.client.producer.DefaultMQProducer;
//import org.apache.rocketmq.client.producer.SendResult;
//import org.apache.rocketmq.common.message.Message;
//import org.apache.rocketmq.remoting.exception.RemotingException;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
///**
// * @ClassName MQProducerController
// * @Description TODO
// * @Author duqc
// * @Date 2021/4/12
// **/
//@Slf4j
//@RestController
//@RequiredArgsConstructor
//@RequestMapping("/mq/producer")
//public class MQProducerController {
//
//    private final DefaultMQProducer producer;
//
//    /**
//     * 消息发送
//     *
//     * @param msg
//     * @return
//     */
//    @GetMapping("send")
//    public String send(String msg) throws InterruptedException, RemotingException, MQClientException, MQBrokerException {
//        Message message = new Message("HelloTopic", msg.getBytes());
//        //默认3秒超时
//        SendResult send = producer.send(message);
//        log.info("消息发送响应:" + send.toString());
//        return "消息发送响应:" + send.toString();
//    }
//
//}
